package com.freewater.parking.infrastructure.domain;

import com.freewater.parking.domain.common.PlateNumber;
import com.freewater.parking.domain.parking.AlarmService;
import com.freewater.parking.infrastructure.db.AlarmDao;
import com.freewater.parking.infrastructure.db.AlarmTable;

public class AlarmServiceImpl implements AlarmService {

    private final AlarmDao alarmDao;

    public AlarmServiceImpl(AlarmDao alarmDao) {
        this.alarmDao = alarmDao;
    }

    @Override
    public void alarm(PlateNumber plateNumber, String msg) {
        AlarmTable record = new AlarmTable();
        record.setPlateNumber(plateNumber.getValue());
        record.setMsg(msg);
        this.alarmDao.save(record);
    }
}
